package com.songtai.po;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import com.songtai.util.Constants;

/**
 * Node entity. @author zzy
 */
public class Node implements java.io.Serializable {

	/**
	 * 序列号
	 */
	private static final long serialVersionUID = -1610774339205159235L;
	// 节点ID
	private Long id;
	// 父节点
	private Node parent;
	// 节点名称
	private String nodeName;
	// 子节点集合
	private Set<Node> childrens = new HashSet<Node>(0);
	// 状态(默认上线)
	private String status = Constants.STATUS_ONLINE;
	// 插入时间(默认系统时间)
	private Date insertDate = new Date();
	// 位置(显示先后位置)
	private int position = 1;
	// 节点类型(默认父节点)
	private String nodeType = Constants.NODETYPE_PNODE;

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the nodeName
	 */
	public String getNodeName() {
		return nodeName;
	}

	/**
	 * @param nodeName
	 *            the nodeName to set
	 */
	public void setNodeName(String nodeName) {
		this.nodeName = nodeName;
	}

	/**
	 * @return the parent
	 */
	public Node getParent() {
		return parent;
	}

	/**
	 * @param parent
	 *            the parent to set
	 */
	public void setParent(Node parent) {
		this.parent = parent;
	}

	/**
	 * @return the childrens
	 */
	public Set<Node> getChildrens() {
		return childrens;
	}

	/**
	 * @param childrens
	 *            the childrens to set
	 */
	public void setChildrens(Set<Node> childrens) {
		this.childrens = childrens;
	}

	/**
	 * @return the status
	 */
	public String getStatus() {
		return status;
	}

	/**
	 * @param status
	 *            the status to set
	 */
	public void setStatus(String status) {
		this.status = status;
	}

	/**
	 * @return the insertDate
	 */
	public Date getInsertDate() {
		return insertDate;
	}

	/**
	 * @param insertDate
	 *            the insertDate to set
	 */
	public void setInsertDate(Date insertDate) {
		this.insertDate = insertDate;
	}

	/**
	 * @return the position
	 */
	public int getPosition() {
		return position;
	}

	/**
	 * @param position
	 *            the position to set
	 */
	public void setPosition(int position) {
		this.position = position;
	}

	/**
	 * @return the nodeType
	 */
	public String getNodeType() {
		return nodeType;
	}

	/**
	 * @param nodeType the nodeType to set
	 */
	public void setNodeType(String nodeType) {
		this.nodeType = nodeType;
	}

	/**
	 * 添加子节点
	 * 
	 * @param node
	 */
	public void addChildNode(Node node) {
		node.setParent(this);
		this.childrens.add(node);
	}
}